package com.example.his.api.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.example.his.api.common.R;
import com.example.his.api.mis.service.RuleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;

@RestController
@RequestMapping ( "/mis/rule" )
public class RuleController {

  @Resource
  private RuleService ruleService;

  /**
   * 查询所有规则列表
   * @return 包含规则列表的响应结果
   */
  @GetMapping("/searchAllRule")
  @SaCheckLogin
  public R searchAllRule() {
    // 调用服务层方法获取所有规则数据
    ArrayList<HashMap> list = ruleService.searchAllRule();
    // 将查询结果封装到响应对象中并返回
    return R.ok().put("result", list);
  }
  
}
